package servlets;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import utility.UserSession;

/**
 * Servlet implementation class Feedback
 */
public class Feedback extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Feedback() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String scores[] = new String[5];
		scores[0] = request.getParameter("overallScore");
		System.out.println(scores[0]);
		scores[1] = request.getParameter("gameplayScore");
		scores[2] = request.getParameter("marketplaceScore");
		scores[3] = request.getParameter("accountinfoScore");
		scores[4] = request.getParameter("displayScore");
		String userID = (String)request.getSession().getAttribute("userID");
		System.out.println(userID);
		request.setAttribute("message", "Thank you for the feedback!!");
		UserSession.setFeedback(userID, scores);

		RequestDispatcher RequestDispatcherObj =request.getRequestDispatcher("/view/UserHome.jsp");
        RequestDispatcherObj.forward(request, response);

	}

}
